import wx from '@didi/teddy-immutable'

export function setStorageSync(...arg) {
  try {
    wx.setStorageSync(...arg)
  } catch (e) {
  }
}

export function setStorage(...arg) {
  try {
    wx.setStorage(...arg)
  } catch (e) {
  }
}

export function getStorageSync(...arg) {
  let value = undefined
  try {
    value = wx.getStorageSync(...arg)
    if (JSON.stringify(value) === '{}') {
      value = ''
    }
  } catch (e) {
  }

  return value
}

export function removeStorageSync(...arg) {
  try {
    wx.removeStorageSync(...arg)
  } catch (e) {
  }
}
